<?php
namespace tp5_lib\qq\model;

use think\Model;

class QQUserModel extends Model
{
    protected $table="qq_user";
    public function install()
    {
        $table=$this->db()->getTable();
        $sql="CREATE TABLE IF NOT EXISTS `$table` (
            `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
            `user_id` int(11) NOT NULL,
            `openid` varchar(40) NOT NULL,
            `unionid` varchar(40) NOT NULL,
            `nickname` varchar(20) NOT NULL,
            `gender` varchar(10) NOT NULL,
            `province` varchar(20) NOT NULL,
            `city` varchar(20) NOT NULL,
            `year` int(11) NOT NULL,
            `constellation` varchar(20) NOT NULL,
            `figureurl` varchar(100) NOT NULL,
            `figureurl_type` int(11) NOT NULL
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8;";
        $this->db()->execute($sql);
    }
}
